﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<!-- source http://www.scnoob.com More templates http://www.scnoob.com/moban -->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>我的下级订单</title>

    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/bootstrap.min.css}">

    <link rel="stylesheet" type="text/css" th:href="@{/assets/fonts/line-icons.css}">

    <link th:href="@{/assets/plugins/datatables/dataTables.bootstrap4.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/assets/plugins/datatables/buttons.bootstrap4.min.css}" rel="stylesheet" type="text/css"/>

    <link th:href="@{/assets/plugins/datatables/responsive.bootstrap4.min.css}" rel="stylesheet" type="text/css"/>

    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/main.css}">

    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/responsive.css}">
</head>
<body>
<div class="app header-default side-nav-dark">
    <div class="layout">
        <div class="header navbar">
            <div class="header-container">
                <ul class="nav-left">
                    <li>
                        <a href="javascript:history.back(-1);">
                            <i class="lni-chevron-left" style="border: transparent;"></i>
                        </a>
                    </li>
                </ul>
                <ul class="nav-right" style="margin-right: 20px;">
                    <li class="user-profile dropdown dropdown-animated scale-left">
                        <a th:href="@{/front/user/userPath(referId=${referId})}">
                            我的
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="page-container" style="padding: 64px 0 0 0!important;background-color: #f1f2f7;">
            <div class="main-content" style="padding-top: 15px!important;">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-12">
                            <div type="text" style="display: none" id="userId" th:text="${session.userEntity.id}"></div>
                            <div class="card" style="border-radius: 10px;width: 100%;margin-bottom: 10px">
                                <div class="card-header border-bottom">
                                    <h4 class="card-title">下级订单详情</h4>
                                    <div id="tips" style="color: red"></div>
                                </div>
                            </div>

                            <div class="card" style="border-radius: 10px;width: 100%;margin-bottom: 10px">
                                <div class="table-responsive">
                                    <table id="datatable" class="table table-bordered">
                                        <tr>
                                            <td>商品名称</td>
                                            <td th:text="${order.productEntityName}"></td>
                                        </tr>
                                        <tbody>
                                        <tr>
                                            <td>用户付款金额</td>
                                            <td th:text="${order.payMoney}"></td>
                                        </tr>
                                        <tr>
                                            <td>用户支付状态</td>
                                            <td th:switch="${order.payStatus}" class="text-center">
                                                <span th:case="'0'">已支付</span>
                                                <span th:case="'1'">支付未被确认</span>
                                                <span th:case="'2'">未支付</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>商家收款金额</td>
                                            <td th:text="${order.referPayMoney}"></td>
                                        </tr>
                                        <tr>
                                            <td>我的转账状态</td>
                                            <td th:switch="${order.referPayStatus}" class="text-center">
                                                <span th:case="'0'">已支付</span>
                                                <span th:case="'1'">支付未被确认</span>
                                                <span th:case="'2'">未支付</span>
                                            </td>
                                        </tr>
<!--                                        <tr th:if="${order.referPayStatus}!=0">-->
<!--                                            <td>转账给商家</td>-->
<!--                                            <td th:switch="${order.referPayStatus}" class="text-center">-->
<!--                                                <span th:case="'0'">已支付</span>-->
<!--                                                <span th:case="'1'">支付未被确认</span>-->
<!--                                                <a th:case="'2'"-->
<!--                                                   th:href="@{findMerchantEntityAccout(orderId=${order.id},productId=${order.productId})}">-->
<!--                                                    <button type="button" class="btn btn-danger btn-rounded"-->
<!--                                                            style="padding: 10px 15px;">-->
<!--                                                        <span>去支付</span>-->
<!--                                                    </button>-->
<!--                                                </a>-->
<!--                                            </td>-->
<!--                                        </tr>-->
                                        <tr>
                                            <td>我的利润</td>
                                            <td th:text="${order.welfareMoney}"></td>
                                        </tr>
                                        <tr>
                                            <td>返利金额</td>
                                            <td th:text="${order.returnMoney}"></td>
                                        </tr>
                                        <tr>
                                            <td>订单状态</td>
                                            <td th:switch="${order.orderStatus}" class="text-center">
                                                <span th:case="'0'">已完成</span>
                                                <span th:case="'1'">未完成</span>
                                            </td>
                                        </tr>
                                        <!--                                            <tr>-->
                                        <!--                                                <td>确认用户支付</td>-->
                                        <!--                                                <td th:switch="${order.payStatus}" class="text-center">-->
                                        <!--                                                    <a th:case="0">用户已支付</a>-->
                                        <!--                                                    &lt;!&ndash; 按钮触发模态框 &ndash;&gt;-->
                                        <!--                                                    <a th:case="'1'">-->
                                        <!--                                                        <button type="button" class="btn btn-outline-success" data-toggle="modal" data-target="#myModal">确认</button></a>-->
                                        <!--                                                    <a th:case="2">未支付</a>-->
                                        <!--                                                </td>-->
                                        <!--                                            </tr>-->
                                        </tbody>
                                    </table>

                                    <!-- 模态框（Modal） -->
                                    <div style="margin-top: 100px" class="modal fade" id="myModal" tabindex="-1"
                                         role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <h4 class="modal-title" id="myModalLabel">确认用户已支付</h4>
                                                    <button type="button" class="close" data-dismiss="modal"
                                                            aria-hidden="true">&times;
                                                    </button>
                                                </div>
                                                <div class="modal-body">确认用户已支付</div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                                        返回
                                                    </button>
                                                    <button type="button" class="btn btn-primary"
                                                            th:onclick="|orderConfirmUserPay(${order.id})|">确认
                                                    </button>
                                                </div>
                                            </div><!-- /.modal-content -->
                                        </div><!-- /.modal -->
                                    </div>


                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>


        </div>

    </div>
</div>

<div id="preloader">
    <div class="loader" id="loader-1"></div>
</div>


<script th:src="@{/assets/js/jquery-min.js}"></script>
<script th:src="@{/assets/js/popper.min.js}"></script>
<script th:src="@{/assets/js/bootstrap.min.js}"></script>
<script th:src="@{/assets/js/jquery.app.js}"></script>
<script th:src="@{/assets/js/main.js}"></script>

<script th:src="@{/assets/plugins/datatables/jquery.dataTables.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/dataTables.bootstrap4.min.js}"></script>

<script th:src="@{/assets/plugins/datatables/dataTables.buttons.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/buttons.bootstrap4.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/jszip.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/pdfmake.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/vfs_fonts.js}"></script>
<script th:src="@{/assets/plugins/datatables/buttons.html5.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/buttons.print.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/buttons.colVis.min.js}"></script>

<script th:src="@{/assets/plugins/datatables/dataTables.responsive.min.js}"></script>
<script th:src="@{/assets/plugins/datatables/responsive.bootstrap4.min.js}"></script>

<script th:src="@{/assets/js/datatables.init.js}"></script>
<link rel="stylesheet" type="text/css" th:href="@{/css/common.css}">
</div>
</body>
<script type="text/javascript">
    $(function () {
        $("#tips").hide();
    });

    function orderConfirmUserPay(orderId) {
        var userId = $("#userId").text();
        console.log(orderId);
        console.log(userId);
        $.post("orderConfirmUserPay",
            {"id": orderId},
            function (data) {
                if (data != "0") {
                    window.open("/front/orderPhone/getAllByReferId?referId=" + userId, "_self");
                } else {
                    $("#tips").text("确认支付失败");
                    $("#tips").show();
                }
            }
        )
    }

</script>

<!-- source http://www.scnoob.com More templates http://www.scnoob.com/moban -->
</html>


